<!DOCTYPE html>
<html lang="zh">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <title>移动端加密聊天工具</title>
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
  <link rel="stylesheet" href="static/css/mobile.css">
</head>
<body>
  <!-- 顶部导航栏 -->
  <div class="app-header">
    <div class="logo">
      <div class="logo-icon">
        <i class="fas fa-lock"></i>
      </div>
      <div class="app-title">
        加密聊天
        <span class="status-indicator status-disconnected" id="status-indicator"></span>
      </div>
    </div>
    <div>
      <button id="settings-btn" class="btn btn-light">
        <i class="fas fa-cog"></i>
      </button>
    </div>
  </div>
  
  <!-- 聊天内容区域 -->
  <div class="chat-container">
    <div class="chat-messages" id="messages">
      <div class="empty-state">
        <i class="fas fa-comment-slash"></i>
        <h5>欢迎使用加密聊天</h5>
        <p>请先创建或加入一个房间</p>
      </div>
    </div>
    
    <div class="chat-input">
      <input type="text" id="message-input" class="message-input" placeholder="输入消息..." disabled>
      <button class="btn-send" onclick="sendMessage()" disabled>
        <i class="fas fa-paper-plane"></i>
      </button>
    </div>
  </div>
  
  <!-- 设置面板 -->
  <div class="overlay" id="overlay"></div>
  <div class="settings-panel" id="settings-panel">
    <div class="settings-header">
      <div class="settings-title">聊天设置</div>
      <button class="close-settings" id="close-settings">
        <i class="fas fa-times"></i>
      </button>
    </div>
    
    <div class="settings-body">
      <div class="settings-section">
        <h3 class="settings-section-title">房间设置</h3>
        
        <button class="btn-action" onclick="createRoom()">
          <i class="fas fa-plus-circle me-2"></i>创建新房间
        </button>
        
        <div class="form-group">
          <label class="form-label">房间ID</label>
          <div class="input-group">
            <input type="text" id="room-id-display" class="form-control" readonly>
            <button class="btn-action" onclick="copyRoomId()" style="margin-top: 10px;">
              <i class="fas fa-copy me-2"></i>复制房间ID
            </button>
          </div>
        </div>
        
        <div class="form-group">
          <label class="form-label">加入房间ID</label>
          <input type="text" id="join-room-id" class="form-control" placeholder="输入房间ID">
        </div>
        
        <div class="form-group">
          <label class="form-label">房间密码</label>
          <input type="password" id="room-password" class="form-control" placeholder="设置房间密码（可选）">
        </div>
        
        <button class="btn-action" onclick="joinRoom()">
          <i class="fas fa-sign-in-alt me-2"></i>加入房间
        </button>
      </div>
      
      <div class="settings-section">
        <h3 class="settings-section-title">在线用户</h3>
        <div id="user-list-container">
          <div class="user-list">
            <div class="user-badge">
              <span class="user-dot"></span>
              <span>暂无用户</span>
            </div>
          </div>
        </div>
      </div>
      
      <div class="settings-section">
        <h3 class="settings-section-title">系统日志</h3>
        <div class="log-panel" id="log-panel">
          <div class="log-entry">
            <span class="log-timestamp">[系统]</span>
            <span class="log-info">欢迎使用端对端加密聊天工具</span>
          </div>
          <div class="log-entry">
            <span class="log-timestamp">[系统]</span>
            <span class="log-info">系统已初始化，等待连接...</span>
          </div>
        </div>
      </div>
      
      <div class="settings-section">
        <h3 class="settings-section-title">免责协议</h3>
        <div class="terms-content mb-2" style="font-size: 0.8rem; line-height: 1.4; max-height: 150px; overflow-y: auto; border: 1px solid #ddd; padding: 10px; background-color: #f8f9fa; border-radius: 4px;">
          <h6>免责协议</h6>
          <p><strong>1. 使用风险</strong><br>
          本工具按"现状"提供，不提供任何形式的保证。使用本工具的风险由您自行承担。</p>
          
          <p><strong>2. 服务可用性</strong><br>
          我们不保证服务将不间断或无错误运行，也不对服务中断或故障负责。</p>
          
          <p><strong>3. 数据安全</strong><br>
          虽然我们采用端对端加密技术，但无法保证数据传输的绝对安全，您应自行承担数据传输风险。</p>
          
          <p><strong>4. 隐私政策</strong><br>
          我们不会存储您的聊天内容，但会记录必要的连接日志用于服务维护。</p>
          
          <p><strong>5. 法律合规</strong><br>
          您有责任确保使用本工具时遵守当地法律法规，不得用于非法目的。</p>
          
          <p><strong>6. 责任限制</strong><br>
          在任何情况下，我们均不对因使用本工具而造成的任何直接、间接或附带损害负责。</p>
          
          <p><strong>7. 协议变更</strong><br>
          我们保留随时修改本协议的权利，修改后的协议将在更新后立即生效。</p>
        </div>
        <div class="form-check mt-3">
          <input class="form-check-input" type="checkbox" id="agree-terms">
          <label class="form-check-label" for="agree-terms">我已阅读并同意免责协议</label>
        </div>
      </div>
    </div>
  </div>
  
  <script src="https://cdn.jsdelivr.net/npm/uuid@8.3.2/dist/umd/uuidv4.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.7.2/socket.io.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jsencrypt/3.3.1/jsencrypt.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jsrsasign/10.8.2/jsrsasign-all-min.js"></script>
  <script src="static/js/mobile.js"></script>
</body>
</html>